package com.pureland.security.annotations;

import com.pureland.security.aspect.SecurityInnerServiceAspect;
import com.pureland.security.feign.HeaderFeignConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;

import java.lang.annotation.*;

/**
 * @projectName: pureland_cloud
 * @className: com.pureland.security.annotations.ClientEnableResourceServer
 * @description: 资源服务注解
 * @author: tong.li
 * @createTime: 2020/11/17 17:10
 * @version: v1.0
 * @copyright: 版权所有 李彤 © 2020
 */
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@EnableResourceServer
@EnableGlobalMethodSecurity(prePostEnabled = true)
@Import({HeaderFeignConfiguration.class,
        SecurityInnerServiceAspect.class})
public @interface ClientEnableResourceServer {

    /**
     * false 选用     UserInfoTokenServices
     * true  选用     RemoteTokenServices
     *
     * @return true | false
     */
    boolean preferTokenInfo() default false;

}
